<html>
<head>

<script type="text/javascript">
function ajaxFunction(val)
{

//document.writeln(val)
var httpxml;
try
  {
  // Firefox, Opera 8.0+, Safari
  httpxml=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    httpxml=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      httpxml=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
function stateChanged() 
    {
    if(httpxml.readyState==4)
      {
var myObject = eval('(' + httpxml.responseText + ')');

var str="<table><tr><th>ID</th><th>Name</th><th>Class</th><th>Mark</th></tr>";
for(i=0;i<myObject.data.length;i++)
{ 
str = str + "<tr><td>" + myObject.data[i].id + " </td><td>" + myObject.data[i].name +  " </td><td>" + myObject.data[i].myclass + " </td><td>" + myObject.data[i].mark + "</td></tr>"
}
var endrecord=myObject.value[0].endrecord 


myForm.st.value=endrecord;
if(myObject.value[0].end =="yes"){ document.getElementById("fwd").style.display='inline';
}else{document.getElementById("fwd").style.display='none';}


if(myObject.value[0].startrecord =="yes"){ document.getElementById("back").style.display='inline';
}else{document.getElementById("back").style.display='none';}


str = str + "</table>" 
document.getElementById("txtHint").innerHTML=str;
    }
    }

var url="user.php";
var myendrecord=myForm.st.value;
url=url+"?endrecord="+myendrecord;
url=url+"&direction="+val;

url=url+"&sid="+Math.random();
//alert(url)
httpxml.onreadystatechange=stateChanged;
httpxml.open("GET",url,true);
httpxml.send(null);
  document.getElementById("txtHint").innerHTML="Please Wait....";

}
</script>

</head>
<body onload="ajaxFunction('fw')";>
<form name="myForm" onsubmit="ajaxFunction(this.form); return false">
<input type=hidden name=st value=0>
<table width=300>
<tr><td width=150><input type=button id="back" value=Prev onClick="ajaxFunction('bk'); return false"></td><td width=150 align=right><input type=button value=Next id="fwd" onClick="ajaxFunction('fw');  return false"></td></tr></tr>
</form>
<tr><td colspan=2><div id="txtHint"><b>Records will be displayed here</b></div></td></tr>
</table>


</body>
</html>